<?php
// Copyright (C) 2011 Cassian LUP <cassi.lup@gmail.com>
//
 // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//SANITIZE ALL ESCAPES
$sanitize_all_escapes = true;

//STOP FAKE REGISTER GLOBALS
$fake_register_globals = false;

//continue session
if (!isset($_REQUEST['medico']))
    session_start();
//
//landing page definition -- where to go if something goes wrong
$landingpage = "index.php?site=" . $_SESSION['site_id'];
//
// kick out if patient not authenticated
if (isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite'])) {
    $pid = $_SESSION['pid'];
} else {
    session_destroy();
    header('Location: ' . $landingpage . '&w');
    exit;
}
//

$ignoreAuth = true;
include_once('../interface/globals.php');

require_once("$srcdir/options.inc.php");
require_once("../interface/globals.php");
require_once("$srcdir/patient.inc");
require_once("$srcdir/acl.inc");
require_once("$srcdir/classes/Address.class.php");
require_once("$srcdir/classes/InsuranceCompany.class.php");
require_once("$srcdir/classes/Document.class.php");
require_once("$srcdir/options.inc.php");
require_once("../interface/patient_file/history/history.inc.php");
require_once("$srcdir/formatting.inc.php");
require_once("$srcdir/edi.inc");
include_once("$srcdir/lists.inc");
require_once("$srcdir/clinical_rules.php");
require_once("$srcdir/sql.inc");
?>
<h1>Reportes</h1>
<?php if ($GLOBALS['activate_ccr_ccd_report']) { // show CCR/CCD reporting options  ?>
    <tr>
        <td width='650px'>
            <br/>
            <div style='margin-left:3em; margin-right:3em; padding:1em; border: 1px solid #CCCCCC;' class='text'>
                <div id="ccr_report">
                    <form name='ccr_form' id='ccr_form' method='post' action='../ccr/createCCR.php?portal_auth=1'>
                        <span class='text'><b><?php echo htmlspecialchars(xl('Continuity of Care Record (CCR)'), ENT_NOQUOTES); ?></b></span>&nbsp;&nbsp;
                        <br/>
                        <span class='text'>(<?php echo htmlspecialchars(xl('Pop ups need to be enabled to see these reports'), ENT_NOQUOTES); ?>)</span>
                        <br/>
                        <br/>
                        <input type='hidden' name='ccrAction'>
                        <input type='hidden' name='raw'>
                        <input type="checkbox" name="show_date" id="show_date" onchange="show_date_fun();" ><span class='text'><?php echo htmlspecialchars(xl('Use Date Range'), ENT_NOQUOTES); ?>
                            <br>
                            <div id="date_div" style="display:none" >
                                <br>
                                <table border="0" cellpadding="0" cellspacing="0" >
                                    <tr>
                                        <td>
                                            <span class='bold'><?php echo htmlspecialchars(xl('Start Date'), ENT_NOQUOTES); ?>: </span>
                                        </td>
                                        <td>
                                            <input type='text' size='10' name='Start' id='Start'
                                                   onkeyup='datekeyup(this, mypcc)' onblur='dateblur(this, mypcc)'
                                                   title='<?php echo htmlspecialchars(xl('yyyy-mm-dd'), ENT_QUOTES); ?>' />
                                            <img src='../interface/pic/show_calendar.gif' align='absbottom' width='24' height='22'
                                                 id='img_start' border='0' alt='[?]' style='cursor:pointer'
                                                 title='<?php echo htmlspecialchars(xl('Click here to choose a date'), ENT_QUOTES); ?>' >
                                            <script LANGUAGE="JavaScript">
                                        Calendar.setup({inputField: "Start", ifFormat: "%Y-%m-%d", button: "img_start"});
                                            </script>
                                        </td>
                                        <td>
                                            &nbsp;
                                            <span class='bold'><?php echo htmlspecialchars(xl('End Date'), ENT_NOQUOTES); ?>: </span>
                                        </td>
                                        <td>
                                            <input type='text' size='10' name='End' id='End'
                                                   onkeyup='datekeyup(this, mypcc)' onblur='dateblur(this, mypcc)'
                                                   title='<?php echo htmlspecialchars(xl('yyyy-mm-dd'), ENT_QUOTES); ?>' />
                                            <img src='../interface/pic/show_calendar.gif' align='absbottom' width='24' height='22'
                                                 id='img_end' border='0' alt='[?]' style='cursor:pointer'
                                                 title='<?php echo htmlspecialchars(xl('Click here to choose a date'), ENT_QUOTES); ?>' >
                                            <script LANGUAGE="JavaScript">
                                        Calendar.setup({inputField: "End", ifFormat: "%Y-%m-%d", button: "img_end"});
                                            </script>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <br>
                            <input type="button" class="generateCCR" value="<?php echo htmlspecialchars(xl('View/Print'), ENT_QUOTES); ?>" />
                            <!-- <input type="button" class="generateCCR_download_h" value="<?php echo htmlspecialchars(xl('Download'), ENT_QUOTES); ?>" /> -->
                            <input type="button" class="generateCCR_download_p" value="<?php echo htmlspecialchars(xl('Download'), ENT_QUOTES); ?>" />
                            <!-- <input type="button" class="generateCCR_raw" value="<?php echo htmlspecialchars(xl('Raw Report'), ENT_QUOTES); ?>" /> -->
                            <hr/>
                            <span class='text'><b><?php echo htmlspecialchars(xl('Continuity of Care Document (CCD)'), ENT_NOQUOTES); ?></b></span>&nbsp;&nbsp;
                            <br/>
                            <span class='text'>(<?php echo htmlspecialchars(xl('Pop ups need to be enabled to see these reports'), ENT_NOQUOTES); ?>)</span>
                            <br/>
                            <br/>
                            <input type="button" class="viewCCD" value="<?php echo htmlspecialchars(xl('View/Print', ENT_QUOTES)); ?>" />
                            <!-- <input type="button" class="viewCCD_raw" value="<?php echo htmlspecialchars(xl('Raw Report', ENT_QUOTES)); ?>" /> -->
                    </form>
                </div>
            </div>
            <br/>
        </div>
    </td>
    </tr>
<?php } // end CCR/CCD reporting options  ?>

